#!/bin/bash

#File:set_jdk_env.sh(原创)

jdk_setup_dir="/opt/jdk1.8.0_121"

# 设置环境变量
echo -e "#--------------------------- 设置JDK环境变量 ---------------------------" >> /etc/profile
echo -e "JAVA_HOME=$jdk_setup_dir" >> /etc/profile
echo -e  "JRE_HOME=$jdk_setup_dir/jre\n" >> /etc/profile

echo -e "CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib" >> /etc/profile
echo -e "PATH=$JAVA_HOME/bin:$PATH:$GRADLE_HOME/bin\n" >> /etc/profile

echo -e "export PATH JAVA_HOME CLASSPATH\n\n" >> /etc/profile

source /etc/profile

echo -e "jdk环境变量设置完成\n"

java -version